Skip to content

Conversation

@syadupathi-sf
Copy link
Collaborator

@syadupathi-sf syadupathi-sf commented Oct 22, 2025

Description

Guest shopper now will see an OTP modal when the opt to register. On successful auth, the shopper is registered and they can place order. Their shipping address, billing phone and payment will be saved when they click place order.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Changes

  • Guest shopper can opt to register before placing order
  • The registration flow will show an OTP modal and send the OTP via email. A successful auth will register the user.
  • Now the guest user is registered and they can place their order. This means they are logged in and they can navigate to their account page.
  • Their billing phone, shipping address and payment is saved and is visible in their account page.

How to Test-Drive This PR

  • Guest user checkout - without opting in to register
  • Guest user checkout - with opt in
  • Verify their account details are saved

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Oct 22, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

"license": "See license in LICENSE",
"dependencies": {
"commerce-sdk-isomorphic": "4.0.1-preview-shopper-configurations.0",
"commerce-sdk-isomorphic": "4.0.0-nightly-20251016080758",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR SalesforceCommerceCloud/commerce-sdk-isomorphic#235 that will generate a new preview release once merged. I need to update the version here since we need the changes in that new release for this PR.

@syadupathi-sf syadupathi-sf marked this pull request as ready for review October 22, 2025 21:43
@syadupathi-sf syadupathi-sf requested a review from a team as a code owner October 22, 2025 21:43
@syadupathi-sf syadupathi-sf added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Oct 22, 2025
) => {
if (items?.length) {
const payload = items.map((item) => {
const productId = item.productId || item.product_id || item.id || item.product?.id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do all these variations come from?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it somehow stem from ocapi vs scapi response? Wonder if we should 'normalize' the object prior tothis

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list products vs get product API response differences. would be nice to have a centralized normalization function

import {useShopperBasketsMutation} from '@salesforce/commerce-sdk-react'

// Dev-only debug logger to keep recovery silent in production
const devDebug = (...args) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this live somewhere others can use it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook was created as a fallback when the merge basket is not available. It creates a new basket and copies everything from the merge basket to the newly created basket. We want to avoid using this hook if possible. It will be explored in a different ticket. I will leave the comments for this file as-is for now.

let hydrated = null
try {
hydrated = await api.shopperBaskets.getBasket({
headers: {authorization: `Bearer ${auth.get('access_token')}`},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this sort of thing the responsibility of the SDK? I haven't seen any other API requests have inline token management. Why exactly is this required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow the user context isn't refreshed when a guest becomes a registered user and we get stale basket or we lose the merged basket. This is an attempt to get the registered user's basket by explicitly specifying the access token. We will be re-visiting the logic in this file in another ticket. I will leave this as-is for now.

Copy link
Contributor

@dannyphan2000 dannyphan2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA video looks good to me

@syadupathi-sf syadupathi-sf merged commit 0bc811f into feature/1cc_payments Nov 7, 2025
17 of 42 checks passed
@syadupathi-sf syadupathi-sf deleted the syadupathi.W-19425801.guestCustFlow branch November 7, 2025 15:53
dannyphan2000 pushed a commit that referenced this pull request Nov 7, 2025
* initial changes

* tests and other adjustments

* fix to eliminate the OTP modal fluctuating its visibility

* clean up code

* skip changelog

* cleanup the hook

* translations

* guest flow changes

* merge basket change (#3448)

* avoid duplicate OTP

* tweak for returning vs newly regstered guest users

* tests and lint

* minor changes

* address code review comment

* fix lint in commerce-sdk-react

* refactor minor

---------

Co-authored-by: kumaravinashcommercecloud <[email protected]>
kumaravinashcommercecloud added a commit that referenced this pull request Nov 10, 2025
* initial changes

* tests and other adjustments

* fix to eliminate the OTP modal fluctuating its visibility

* clean up code

* skip changelog

* cleanup the hook

* translations

* guest flow changes

* merge basket change (#3448)

* avoid duplicate OTP

* tweak for returning vs newly regstered guest users

* tests and lint

* minor changes

* address code review comment

* fix lint in commerce-sdk-react

* refactor minor

---------

Co-authored-by: kumaravinashcommercecloud <[email protected]>
kumaravinashcommercecloud added a commit that referenced this pull request Nov 10, 2025
* initial changes

* tests and other adjustments

* fix to eliminate the OTP modal fluctuating its visibility

* clean up code

* skip changelog

* cleanup the hook

* translations

* guest flow changes

* merge basket change (#3448)

* avoid duplicate OTP

* tweak for returning vs newly regstered guest users

* tests and lint

* minor changes

* address code review comment

* fix lint in commerce-sdk-react

* refactor minor

---------

Co-authored-by: kumaravinashcommercecloud <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants